package com.zc.im.mapper.im.group;

import com.zc.im.model.im.group.ZcImDirectory;
import com.zc.im.model.im.group.ZcImDirectoryExample;
import com.zc.im.model.im.group.ZcImDirectoryKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ZcImDirectoryMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory
     *
     * @mbggenerated
     */
    int countByExample(ZcImDirectoryExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory
     *
     * @mbggenerated
     */
    int deleteByExample(ZcImDirectoryExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory
     *
     * @mbggenerated
     */
    @Delete({
        "delete from zc_im_directory",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(ZcImDirectoryKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory
     *
     * @mbggenerated
     */
    @Insert({
        "insert into zc_im_directory (id, user_id, ",
        "friends_id, add_source, ",
        "friends_relation_flag, group_id, ",
        "created_time, updated_time, ",
        "company_id, status)",
        "values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, ",
        "#{friendsId,jdbcType=INTEGER}, #{addSource,jdbcType=VARCHAR}, ",
        "#{friendsRelationFlag,jdbcType=VARCHAR}, #{groupId,jdbcType=INTEGER}, ",
        "#{createdTime,jdbcType=TIMESTAMP}, #{updatedTime,jdbcType=TIMESTAMP}, ",
        "#{companyId,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=true, resultType=Integer.class)
    int insert(ZcImDirectory record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory
     *
     * @mbggenerated
     */
    int insertSelective(ZcImDirectory record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory
     *
     * @mbggenerated
     */
    List<ZcImDirectory> selectByExample(ZcImDirectoryExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "id, user_id, friends_id, add_source, friends_relation_flag, group_id, created_time, ",
        "updated_time, company_id, status",
        "from zc_im_directory",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ZcImDirectory selectByPrimaryKey(ZcImDirectoryKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") ZcImDirectory record, @Param("example") ZcImDirectoryExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") ZcImDirectory record, @Param("example") ZcImDirectoryExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(ZcImDirectory record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory
     *
     * @mbggenerated
     */
    @Update({
        "update zc_im_directory",
        "set user_id = #{userId,jdbcType=INTEGER},",
          "friends_id = #{friendsId,jdbcType=INTEGER},",
          "add_source = #{addSource,jdbcType=VARCHAR},",
          "friends_relation_flag = #{friendsRelationFlag,jdbcType=VARCHAR},",
          "group_id = #{groupId,jdbcType=INTEGER},",
          "created_time = #{createdTime,jdbcType=TIMESTAMP},",
          "updated_time = #{updatedTime,jdbcType=TIMESTAMP},",
          "company_id = #{companyId,jdbcType=INTEGER},",
          "status = #{status,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ZcImDirectory record);
}